package com.youcash.ZyWallet_spring.service.impl;

import com.youcash.ZyWallet_spring.dao.InstalmentMethodMapper;
import com.youcash.ZyWallet_spring.entity.InstalmentMethod;
import com.youcash.ZyWallet_spring.service.InstalmentMethodService;
import com.youcash.ZyWallet_spring.vo.ResStatus;
import com.youcash.ZyWallet_spring.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class InstalmentMethodServiceImpl implements InstalmentMethodService {

    @Autowired
    InstalmentMethodMapper instalmentMethodMapper;

    @Override
    public ResultVO listMethod() {
        Example example = new Example(InstalmentMethod.class);
        List<InstalmentMethod> instalmentMethods = instalmentMethodMapper.selectByExample(example);
        if (instalmentMethods.size() == 0) {
            return new ResultVO(ResStatus.NO, "查询失败！", null);
        } else {
            return new ResultVO(ResStatus.OK, "查询成功！", instalmentMethods);
        }
    }
}
